#include<iostream>
#include<cstring>
using namespace std;

typedef long long LL;
const int N = 40;
int f[N][N];
int main()
{
	int n; cin >> n;

	memset(f, -1, sizeof f);
	f[1][(n + 1) / 2] = 1;
	int x = 1, y = (n + 1) / 2;
	for (int i = 2; i <= n * n; i++)
	{
		if (x == 1 && y != n)
		{
			f[n][y + 1] = i;
			x = n, y++;
		}
		else if (y == n && x != 1)
		{
			f[x - 1][1] = i;
			x--, y = 1;
		}
		else if (x == 1 && y == n)
		{
			f[x + 1][y] = i;
			x++;
		}
		else if (x != 1 && y != n)
		{
			if (f[x - 1][y + 1] == -1)
			{
				f[x - 1][y + 1] = i;
				x--, y++;
			}
			else
			{
				f[x + 1][y] = i;
				x++;
			}
		}
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			cout << f[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}